﻿using Puddy.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace Puddy.Models
{
    [DataContract()]
    public class SettingAlarm
    {
        public SettingAlarm()
        {
        }

        public SettingAlarm(int _distanceType, int _distance, String stonePath)
        {
            distanceType = _distanceType;
            Distance = _distance;
            alarmTonePath = stonePath;
        }

        int distanceType;

        [DataMember(Name = "DistanceType")]
        public int DistanceType
        {
            get { return distanceType; }
            set { distanceType = value; }
        }

        float distance;

         [DataMember(Name = "Distance")]
        public float Distance
        {
            get { return distance; }
            set { 
                distance = value;
                if (distanceType == Constants.KM_TYPE)
                {
                    distanceByMeter = distance * 1000;
                }
                else if (distanceType == Constants.MILES_TYPE)
                {
                    // 1 miles = 1609.34 m
                    distanceByMeter = distance * 1609.34;
                }
            }
        }

        double distanceByMeter;

        public double DistanceByMeter
        {
            get { return distanceByMeter; }
            set { distanceByMeter = value; }
        }

        String alarmTonePath;
         [DataMember(Name = "AlarmTonePath")]
        public String AlarmTonePath
        {
            get { return alarmTonePath; }
            set { alarmTonePath = value; }
        }

        
    }
}
